package org.smartjava.concurrent.core;

import org.smartjava.util.PrintUtil;

public class ThreadExample {
    public static void main(String[] args) {
        OrderService orderService = new OrderService();
        new Thread(() -> orderService.save(), "Order-Thread").start();
    }
}

class OrderService {
    void save() {
        PrintUtil.print("保存订单");
    }

    void cancel() {
        PrintUtil.print("取消订单");
    }
}

class OrderServiceThread extends Thread {
    @Override
    public void run() {
        save();
    }

    void save() {
        PrintUtil.print("保存订单");
    }
}

class OrderServiceRunnable implements Runnable {
    @Override
    public void run() {
        save();
    }

    void save() {
        PrintUtil.print("保存订单");
    }
}
